package object.model;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class JavaFile {
	private String packageName;
	private String className;
	private List<JavaVariables> vars;
	private Set<String> importers;
	private TableType type;
	
	public JavaFile(String packageName, String className, List<JavaVariables> vars, TableType type) {
		this.type = type;		
		this.packageName = packageName + ((type == TableType.VIEW)?".view":"");
		this.className = className;
		this.vars = vars;		
		this.iniImporters();
	}
	
	private void iniImporters(){
		importers = new HashSet<String>();
		for(int i=0;i<vars.size();i++){
			JavaVariables dI = vars.get(i);
			try{
				if(dI.getClassFullName().contains("byte") || dI.getClassFullName().contains("boolean")){
					continue;
				}else{
					importers.add(dI.getClassFullName());
				}		
			}catch(Exception e){
				e.printStackTrace();
			}
				
		}		
	}
	
	public Set<String> getImporters() {
		return importers;
	}
	
	public TableType getType() {
		return type;
	}

	public String getPackageName() {
		return packageName;
	}
	public void setPackageName(String packageName) {
		this.packageName = packageName;
	}
	public String getClassName() {
		return className;
	}
	public void setClassName(String className) {
		this.className = className;
	}
	public List<JavaVariables> getVars() {
		return vars;
	}
	public void setVars(List<JavaVariables> vars) {
		this.vars = vars;
	}	
}
